package com.aynu.webshop.web.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.aynu.webshop.core.generic.GenericDao;
import com.aynu.webshop.core.generic.GenericServiceImpl;
import com.aynu.webshop.web.dao.CategoryMapper;
import com.aynu.webshop.web.model.Category;
import com.aynu.webshop.web.service.CategoryService;

@Service
public class CategoryServiceImpl extends GenericServiceImpl<Category, Integer> implements CategoryService {

	@Resource
	private CategoryMapper categoryMapper;
	
	@Override
	public int insert(Category model) {
		// TODO Auto-generated method stub
		return categoryMapper.insertSelective(model);
	}

	@Override
	public int update(Category model) {
		// TODO Auto-generated method stub
		return categoryMapper.updateByPrimaryKeySelective(model);
	}

	@Override
	public int delete(Integer id) {
		// TODO Auto-generated method stub
		return categoryMapper.deleteByPrimaryKey(id);
	}

	@Override
	public Category selectById(Integer id) {
		// TODO Auto-generated method stub
		return categoryMapper.selectByPrimaryKey(id);
	}

	@Override
	public Category selectOne() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public List<Category> selectList() {
		// TODO Auto-generated method stub
		return categoryMapper.findAll();
	}

	@Override
	public GenericDao<Category, Integer> getDao() {
		// TODO Auto-generated method stub
		return categoryMapper;
	}

	@Override
	public List<Category> selectListParent() {
		// TODO Auto-generated method stub
		return categoryMapper.findAllParent();
	}

	@Override
	public List<Category> selectListChild(Integer cid) {
		// TODO Auto-generated method stub
		return categoryMapper.findAllChild(cid);
	}



}
